public class daxiao {
    public static void main(String[] args) {
       int[] arr={1,2,3,4,5,6};
       int[] r=getArrMaxAndMin(arr);
        System.out.println(r[0]);
        System.out.println(r[1]);



    }
    public static int[] getArrMaxAndMin(int[]arr){
        int[] result =new int[2];
        int max=arr[0];
        int min=arr[0];
        for (int i = 1; i < arr.length; i++) {
            if(arr[i]>max){
                max=arr[i];
            }
            if(arr[i]<min){
                min=arr[i];
            }

        }
        result[0]=max;
        result[1]=min;
        return result;

    }


}
